<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">

<xi:include href="master.html" />
<?python
from turbogears.i18n.format import format_date
def dateandtime(d):
    return format_date(d, format="full", time_format=" @ %X %Z")
?>

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>Yale Club Beijing</title>
    <style type="text/css">
        #newsbox-title, #eventsbox-title{
    font-size: 20px;
}

#newsbox, #eventsbox{
    padding-top: 5px;
}

.news, .event{
    padding-bottom: 15px;
}

.event{
    cursor: pointer;
    padding: 5px;
}

.news-title, .event-title{
    font-size: 15px;
    font-weight: bold;
}
#bread{display:none;}
    </style>
    <link rel="stylesheet" type="text/css" href="/static/css/calendar-eightysix-v1.1-default.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="/static/css/calendar-eightysix-v1.1-vista.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="/static/css/calendar-eightysix-v1.1-osx-dashboard.css" media="screen" />
    <script type="text/javascript" src="/static/javascript/calendar-eightysix-v1.1.js"></script>
    <script type="text/javascript">
    //<![CDATA[
    window.addEvent('domready',function(){
        $$$$('div.event').each(function(item, index){
            item.addEvent('mouseenter', function(){
                item.style.backgroundColor = "#fbf9d6";
            });
            item.addEvent('mouseleave', function(){
                item.style.backgroundColor = "white";
            });
            item.addEvent('click', function(){
                document.location = "events?eid=" + item.getAttribute('eid');
            });
        });
        var eventdates = ${str(eventdates)};
        var calendar = new CalendarEightysix('eventcalendar', { 'injectInsideTarget': true, 'alwaysShow': true, 'pickable': false });
		calendar.addEvent('rendermonth', function(e) {
			e.elements.each(function(day) {
				day.set('title', day.retrieve('date').format('%A %d %B'));
				var datestring = day.retrieve('date').format('%Y%m%d');
				if (eventdates.contains(datestring)){
				    day.setStyles({'color': 'firebrick', 'font-weight': 'bold', 'cursor': 'pointer'}).addEvent('click', function(){
				        document.location = "events?date=" + datestring;
				    });
				}				
			});
		});
		calendar.render();
    });
    //]]>
    </script>
</head>
<body>

<div id="content-left">
    <div id="content-left-top">
        <h2 id="wel-eng">Welcome to Yale Club Beijing!</h2>
        <h2 id="wel-chs">北京耶鲁校友会欢迎你！</h2>
    </div>
    <div id="content-left-bottom">
        <h2 py:if="news.count() != 0" id="newsbox-title">YCB News &amp; Announcements</h2>
        <div id="newsbox">
            <div py:for="n in news" class="news">
                <div class="news-title">${n.title}</div>
                <div class="news-summary">${n.summary} [<a href="news?nid=${n.id}">more</a>]</div>
            </div>
        </div>
    </div>
</div>

<div id="content-right">
    <div id="content-right-top">
        <p>Welcome to the Yale Club of Beijing! We welcome you to join our events, volunteer to serve,
        and become a part of our community. And we welcome your thoughts on our
        programming. You belong here.</p> 
        <p>So please sign in, sign up, or sound off!</p>
    </div>
    <div id="content-right-bottom">
        <!--h2 id="eventsbox-title">Upcoming Events</h2-->
        <div id="eventcalendar" style="height: 180px; clear:both;"></div>
        <div id="eventsbox">
            <!--div py:for="e in events" class="event" eid="${e.id}">
                <div class="event-title">${e.starttime.date()} ${e.title}</div>
                <div class="event-summary">${e.starttime.time()} @${e.location}</div>
            </div-->
            <div class="text-right">[<a href="events">more events</a>]</div>
        </div>
    </div>
</div>



    <!--! template functions -->
    <!--span py:def="code(codestring)" py:content="codestring" class="code" />

    <div class="content-section">
        <div class="news" py:for="n in news">
            ${n.title}
        </div>
    </div-->

</body>
</html>
